export default {
  container: `<div class="reader-chapter" id="reader-scroll">
          <div class="reader-chapter__scroll-box"></div>
          </div>`
  ,
  chapterContainer(data) {
    return `<div class="reader-chapter__item-box" chapter-id="${data.chapterId}">${data.slot}</div>`
  },
  imageContainer(data) {
    const innerHTML = `<img class="chapter-img" /><div class="loading-tip">${data.chapterIndex}</div>`;
    if (data.isRetry) {
      return innerHTML;
    }
    return `<div style="width:${data.width}px;height:${data.height}px" class="reader-chapter__item" data-chapter-index=${data.chapterIndex} data-chapter-id=${data.chapterId}>${innerHTML}</div>`
  },
  adContainer() {
    return `<div></div>`
  },
  copyrightContainer(data) {
    return `<div class="reader-no-copyright">
          <img width="100" src="${data.src}" alt="${data.alt}"><br>
          ${data.message}
          <a class="url-back" href="javascript:;" onclick="history.go(-1);" title="返回">返回上一页</a>
        </div>`
  },
  panelInfo(data) {
    let chapterInfo = ''
    if (data.hasCopyright) {
      chapterInfo = `<span id="js_staticChapter">${data.name}</span>&nbsp; <span id="js_staticPage">${data.page}</span>&nbsp;`
    }
    return `<section class="reader-static">${chapterInfo}<span id="js_staticTime">${data.time}</span>&nbsp;</section>`
  },
  menu(data) {
    return `
    <section class="reader-menu top" id="js_header">
    <a href="javascript:history.back();" nofollow="nofollow" class="ift-left" alt="返回">返回</a>
    <h1 class="reader-menu-title">
      <span class="title">${data.comicName}</span>
      <span class="progress" id="js_chapterProgress"></span>
    </h1>
    <a class="ift-home" href="/" alt="首页"></a>
    </section>
    <section class="reader-menu bottom" id="js_footer">
      <div class="flex">
        <a class="ift-catalog" href="/ac/${data.comicId}" alt="目录">目录</a>
      </div>
      <div class="chapter-pages">
        <span class="ift-left next" id="js_nextChapter" alt="下一章">下一章</span>
        <span class="ift-right prev" id="js_prevChapter" alt="上一章">上一章</span>
      </div>
    </section>`
  },

  cnzz(data) {
    return `<script>window.cnzz=['_trackEvent','${data.comicName}','kmh_pc','',${data.comicId}];</script><script src='//vvip.cnzz.com/stat.php?id=1255417151&amp;web_id=1255417151&amp;show=none'></script>`
  },

  errorReply(data) {
    return `<div class="tip-error-msg">
      <p>《${data.comicName}》${data.chapterName}</p>
      <p>第${data.chapterIndex}页加载失败，您可以:</p>
      <span class="tip-error-btn" data-chapter-id="${data.chapterId}" data-chapter-index="${data.chapterIndex}">重试</span></div>`;
  }
}
